home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / Carp.z / Carp
Encoding:
Text File  |  1998-10-30  |  1.9 KB  |  67 lines

  1.  
  2.  
  3.  
  4. CCCCaaaarrrrpppp((((3333))))                                                                CCCCaaaarrrrpppp((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      carp    - warn of errors (from perspective of caller)
  10.  
  11.      cluck   - warn of errors with stack backtrace
  12.                (not exported by default)
  13.  
  14.      croak   - die of errors (from perspective of caller)
  15.  
  16.      confess - die of errors with stack backtrace
  17.  
  18. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  19.          use Carp;
  20.          croak "We're outta here!";
  21.  
  22.          use Carp qw(cluck);
  23.          cluck "This is how we got here!";
  24.  
  25.  
  26. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  27.      The Carp routines are useful in your own modules because they act like
  28.      _d_i_e() or _w_a_r_n(), but report where the error was in the code they were
  29.      called from.  Thus if you have a routine _F_o_o() that has a _c_a_r_p() in it,
  30.      then the _c_a_r_p() will report the error as occurring where _F_o_o() was
  31.      called, not where _c_a_r_p() was called.
  32.  
  33.      FFFFoooorrrrcccciiiinnnngggg aaaa SSSSttttaaaacccckkkk TTTTrrrraaaacccceeee
  34.  
  35.      As a debugging aid, you can force Carp to treat a croak as a confess and
  36.      a carp as a cluck across _a_l_l modules. In other words, force a detailed
  37.      stack trace to be given.  This can be very helpful when trying to
  38.      understand why, or from where, a warning or error is being generated.
  39.  
  40.      This feature is enabled by 'importing' the non-existant symbol 'verbose'.
  41.      You would typically enable it by saying
  42.  
  43.          perl -MCarp=verbose script.pl
  44.  
  45.      or by including the string MCarp=verbose in the the _P_E_R_L_5_O_P_T manpage
  46.      environment variable.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.